home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / barcodes.zip / SAMPLE1.ZIP / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1994-11-07  |  3KB  |  113 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3. // (c) Copyright 1994 HEX TECHNOLOGY. All rights reserved.
  4. // This sample code is provided as a example implementation
  5. // using barcodes.dll.  You may only distribute or modify this
  6. // code if you purchase a license for barcodes.dll.
  7.  
  8. #include "stdafx.h"
  9. #include "bartest.h"
  10.  
  11. #include "mainfrm.h"
  12.  
  13. #ifdef _DEBUG
  14. #undef THIS_FILE
  15. static char BASED_CODE THIS_FILE[] = __FILE__;
  16. #endif
  17.  
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMainFrame
  20.  
  21. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  22.  
  23. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  24.     //{{AFX_MSG_MAP(CMainFrame)
  25.         // NOTE - the ClassWizard will add and remove mapping macros here.
  26.         //    DO NOT EDIT what you see in these blocks of generated code !
  27.     ON_WM_CREATE()
  28.     //}}AFX_MSG_MAP
  29. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // arrays of IDs used to initialize control bars
  33.  
  34. // toolbar buttons - IDs are command buttons
  35. static UINT BASED_CODE buttons[] =
  36. {
  37.     // same order as in the bitmap 'toolbar.bmp'
  38.     ID_FILE_NEW,
  39.     ID_FILE_OPEN,
  40.     ID_FILE_SAVE,
  41.         ID_SEPARATOR,
  42.     ID_EDIT_CUT,
  43.     ID_EDIT_COPY,
  44.     ID_EDIT_PASTE,
  45.         ID_SEPARATOR,
  46.     ID_FILE_PRINT,
  47.     ID_APP_ABOUT,
  48. };
  49.  
  50. static UINT BASED_CODE indicators[] =
  51. {
  52.     ID_SEPARATOR,           // status line indicator
  53.     ID_INDICATOR_CAPS,
  54.     ID_INDICATOR_NUM,
  55.     ID_INDICATOR_SCRL,
  56. };
  57.  
  58. /////////////////////////////////////////////////////////////////////////////
  59. // CMainFrame construction/destruction
  60.  
  61. CMainFrame::CMainFrame()
  62. {
  63.     // TODO: add member initialization code here
  64. }
  65.  
  66. CMainFrame::~CMainFrame()
  67. {
  68. }
  69.  
  70. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  71. {
  72.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  73.         return -1;
  74.  
  75.     if (!m_wndToolBar.Create(this) ||
  76.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  77.         !m_wndToolBar.SetButtons(buttons,
  78.           sizeof(buttons)/sizeof(UINT)))
  79.     {
  80.         TRACE("Failed to create toolbar\n");
  81.         return -1;      // fail to create
  82.     }
  83.  
  84.     if (!m_wndStatusBar.Create(this) ||
  85.         !m_wndStatusBar.SetIndicators(indicators,
  86.           sizeof(indicators)/sizeof(UINT)))
  87.     {
  88.         TRACE("Failed to create status bar\n");
  89.         return -1;      // fail to create
  90.     }
  91.  
  92.     return 0;
  93. }
  94.  
  95. /////////////////////////////////////////////////////////////////////////////
  96. // CMainFrame diagnostics
  97.  
  98. #ifdef _DEBUG
  99. void CMainFrame::AssertValid() const
  100. {
  101.     CMDIFrameWnd::AssertValid();
  102. }
  103.  
  104. void CMainFrame::Dump(CDumpContext& dc) const
  105. {
  106.     CMDIFrameWnd::Dump(dc);
  107. }
  108.  
  109. #endif //_DEBUG
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // CMainFrame message handlers
  113.